|
|
|
|
|
|
|
Figure 3.6
Example program LogIndex displays the colors
used in a picture's logical palette. |
|
|
|
|
|
|
|
|
The program then uses the following code to fill the right picture box with rectangles containing each of the colors in its logical palette. The program defines the constant PALETTE_INDEX = &H1000000 to make the code a little easier to understand. |
|
|
|
 |
|
|
|
|
Option Explicit
Private Const PALETTE_INDEX = &H1000000
' Fill picture box Pal with its logical palette
' colors using palette indexes. Private Sub FillPicture()
Dim i As Integer
Dim j As Integer
Dim dx As Single
Dim dy As Single
Dim clr As Long
dx = picPalette.ScaleWidth / 16
dy = picPalette.ScaleHeight / 16
clr = 0
For i = 0 To 16
For j = 0 To 16
picPalette.Line (j * dx, i * dy)-Step(dx, dy), _
clr + PALETTE_INDEX, BF
clr = clr + 1
Next j
Next i
End Sub |
|
|
|
|
|